#ifndef QDEVICEVIEW_H
#define QDEVICEVIEW_H

#include "corelibglobal.h"

#include <QTreeWidget>

struct tagDeviceInfo;

class CORELIB_EXPORT QDeviceView : public QTreeWidget
{
    Q_OBJECT
public:
    explicit QDeviceView(QWidget *parent = 0);
    void    set_enabled(const QMap<int,QString> & enabled);
protected:
    void init();
    QString int_to_ip(uint ip);


    void contextMenuEvent(QContextMenuEvent *);
signals:
    void    select(tagDeviceInfo* device);
protected slots:
    void    device_online(tagDeviceInfo* device);
    void    device_offline(const QString& uuid);

    void    clear_offline();
    void    select_device();
protected:
    friend class QDeviceDelegate;
protected:
    QMap<tagDeviceInfo*,QTreeWidgetItem*>   m_device_to_item;
    QMap<QTreeWidgetItem*,tagDeviceInfo*>   m_item_to_device;
    QMap<QString,QTreeWidgetItem*>          m_uuid_to_item;
    QMap<int,QString>                       m_enabled;
};

#endif // QDEVICEVIEW_H
